package com.example.GUI;

import com.example.demogui.R;

import android.app.Activity;
import android.app.Dialog;
import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.TabHost;

@SuppressWarnings("deprecation")
public class TabHostAndroidActivity extends TabActivity {
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.tab_food_layout);

		Resources res = getResources(); // Resource object to get Drawables
		TabHost tabHost = getTabHost(); // The activity TabHost
		TabHost.TabSpec spec; // Resusable TabSpec for each tab
		Intent intent;
		// Create an Intent to launch an Activity for the tab (to be reused)

		// Initialize a TabSpec for each tab and add it to the TabHost
		intent = new Intent().setClass(this, HotFoodActivity.class);
		spec = tabHost.newTabSpec("water")
				.setIndicator("Water", res.getDrawable(R.drawable.ic_launcher))
				.setContent(intent);

		tabHost.addTab(spec);

		// Do the same for the other tabs

		spec = tabHost.newTabSpec("food")
				.setIndicator("Food", res.getDrawable(R.drawable.ic_launcher))
				.setContent(intent);

		tabHost.addTab(spec);

		// Do the same for the other tabs

		spec = tabHost.newTabSpec("favourite")
				.setIndicator("Favourite Food", res.getDrawable(R.drawable.ic_launcher))
				.setContent(intent);

		tabHost.addTab(spec);

		tabHost.setCurrentTab(0);

	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// TODO Auto-generated method stub
		MenuInflater inflater = getMenuInflater();
		inflater.inflate(R.menu.action_bar, menu);

		return super.onCreateOptionsMenu(menu);
	}
	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		// TODO Auto-generated method stub
		switch (item.getItemId()) {
		case R.id.itLogout:
			
			break;
		case R.id.itProfile:
			Intent intentViewProfile =new Intent(getBaseContext(), ViewProfileActivity.class);
			startActivity(intentViewProfile);
			break;
		case R.id.itBack:
			onBackPressed();
			break;
		default:
			break;
		}
		return super.onOptionsItemSelected(item);
	}
}